
import * as React from 'react';
import { hot } from "react-hot-loader/root";
import Button from '@material-ui/core/Button';
import './app.scss'

interface Props {
   name:
    string
}

class App extends React.Component<Props> {
  getData = async () => {
    return new Promise((resolve, reject)=>{
      setTimeout(() => {
        resolve('异步函数')
      }, 1000);
    })
  }

  otherData = async () => {
    const res = await this.getData()
    console.log(res)
  }

  render() {
    const { name } = this.props;
    console.log(name)
    this.otherData()
    return (
      <>
        <h1 className="test">
          Hello {name}
        </h1>
        <Button variant="contained">this is a material UI button</Button>
      </>
    );
  }
}

export default hot(App);
